package edu.xkd.djc.slice;

import edu.xkd.djc.ResourceTable;
import ohos.aafwk.ability.AbilitySlice;
import ohos.aafwk.content.Intent;
import ohos.aafwk.content.Operation;
import ohos.agp.components.Button;
import ohos.agp.components.Component;

public class MainAbilitySlice extends AbilitySlice {
    Button button;
    @Override
    public void onStart(Intent intent) {
        super.onStart(intent);
        super.setUIContent(ResourceTable.Layout_ability_main);



        Button button1 = (Button) findComponentById(ResourceTable.Id_but1);
        Button button2 = (Button) findComponentById(ResourceTable.Id_but2);
        button1.setClickedListener(listener -> present(new SecondAbilitySlice(), new Intent()));
        button2.setClickedListener(listener -> present(new SecondAbilitySlice(), new Intent()));
       /* button.setClickedListener(new Component.ClickedListener() {
            @Override
            public void onClick(Component component) {
                    Intent intent1 = new Intent();
                    Operation operation = new Intent.OperationBuilder().withDeviceId("").withBundleName("edu.xkd.djc").withAbilityName("edu.xkd.djc.SecondAbility")
                            .build();
                    intent1.setOperation(operation);
                    startAbility(intent1);
            }
        });*/
    }
    @Override
    public void onActive() {
        super.onActive();
    }

    @Override
    public void onForeground(Intent intent) {
        super.onForeground(intent);
    }
}
